package common

type R struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func Success(message string) R {
	return R{
		Code:    2000,
		Message: message,
		Data:    nil,
	}
}

func SuccessWithData(message string, data interface{}) R {
	return R{
		Code:    2000,
		Message: message,
		Data:    data,
	}
}

func Fail(code int, message string) R {
	return R{
		Code:    code,
		Message: message,
		Data:    nil,
	}
}

func FailWithData(code int, message string, data interface{}) R {
	return R{
		Code:    code,
		Message: message,
		Data:    data,
	}
}
